/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.feriaderemates.dao.user;

import com.feriaderemates.domain.userAccount.User;
import com.feriaderemates.domain.userAccount.UserAccountStatus;
import com.feriaderemates.domain.userAccount.UserAccountType;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;

/**
 *
 * @author Lenovo
 */
public class UserRowMapper implements RowMapper {

    public User mapRow(ResultSet rs, int i) throws SQLException {
        
       User user = User.createUserFromDb(
                rs.getInt("user_id"),
                rs.getString("first_name"),
                rs.getString("last_name"),
                rs.getString("second_last_name"),
                rs.getString("username"),
                rs.getString("email"),
                rs.getString("hashed_password"),
                UserAccountType.valueOf(rs.getString("user_account_type")),
                UserAccountStatus.valueOf(rs.getString("user_account_status"))
                );
       
          
        return user;
    }
    
}
